package cn.demoncat.util.zookeeper.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * Zookeeper配置属性
 *
 * @author 延晓磊
 *
 * @since 2017年7月23日
 */
@Component
@ConfigurationProperties(prefix = "demoncat.zookeeper")
public class ZookeeperProperties {

	// ZK连接地址(必须)
	private String url;
	// 会话超时毫秒
	private Integer sessionTimeout = 180000;
	// 连接超时毫秒
	private Integer connectionTimeout = 20000;

	// 连接池 - 最小的空闲对象个数
	private Integer poolMinIdle = 0;
	// 连接池 - 最大的空闲对象个数
	private Integer poolMaxIdle = 5;
	// 连接池 - 最多对象个数（超过时将阻塞等待释放）
	private Integer poolMaxTotal = 20;
	// 连接池 - 空闲对象检测周期毫秒(对象空闲时间为30分钟)
	private Integer poolCheckTime = 300000;
	// 连接池 - 取出时检测是否有效
	private Boolean poolTestOnBorrow = true;

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Integer getSessionTimeout() {
		return sessionTimeout;
	}

	public void setSessionTimeout(Integer sessionTimeout) {
		this.sessionTimeout = sessionTimeout;
	}

	public Integer getConnectionTimeout() {
		return connectionTimeout;
	}

	public void setConnectionTimeout(Integer connectionTimeout) {
		this.connectionTimeout = connectionTimeout;
	}

	public Integer getPoolMinIdle() {
		return poolMinIdle;
	}

	public void setPoolMinIdle(Integer poolMinIdle) {
		this.poolMinIdle = poolMinIdle;
	}

	public Integer getPoolMaxIdle() {
		return poolMaxIdle;
	}

	public void setPoolMaxIdle(Integer poolMaxIdle) {
		this.poolMaxIdle = poolMaxIdle;
	}

	public Integer getPoolMaxTotal() {
		return poolMaxTotal;
	}

	public void setPoolMaxTotal(Integer poolMaxTotal) {
		this.poolMaxTotal = poolMaxTotal;
	}

	public Integer getPoolCheckTime() {
		return poolCheckTime;
	}

	public void setPoolCheckTime(Integer poolCheckTime) {
		this.poolCheckTime = poolCheckTime;
	}

	public Boolean getPoolTestOnBorrow() {
		return poolTestOnBorrow;
	}

	public void setPoolTestOnBorrow(Boolean poolTestOnBorrow) {
		this.poolTestOnBorrow = poolTestOnBorrow;
	}

}
